package com.example.service;

import com.example.model.Result;

public interface SecKillService {

    int deleteById(Long seckillId);

    void deleteRecord();
    /**
     * 普通锁 实现抢购
     * @param seckillId
     * @param buyUserNum
     * @return
     */
    Result buyShopping(Long seckillId, Integer buyUserNum);

    /**
     * AOP锁的方式实现抢购逻辑
     * @param seckillId
     * @param userId
     * @return
     */
    Result buyShoppingByAOP(Long seckillId, Long userId);
    /**
     * 购买逻辑
     * @param secKillId
     * @param userId
     * @return
     */
    Result startSeckill(Long secKillId, Long userId);

    /**
     * 悲观锁 抢购
     * @param seckillId
     * @param userId
     * @return
     */
    Result buyShoppingForUpdate(long seckillId, Long userId);

    /**
     * 乐观锁 抢购
     * @param seckillId
     * @param userId
     * @return
     */
    Result buyShoppingForHapiness(long seckillId, Long userId);

}
